package org.jeecg.enums;

/**
 * 支付模式
 */
public enum PayModeEnum {
    @Deprecated
    PAY_MODE_ALIPAY("alipay", "线上(支付宝)"),
    @Deprecated
    PAY_MODE_WEIXINPAY("weixinpay", "线上(微信)"),
    PAY_MODE_OFFLINE("offline", "线下支付"),
    PAY_MODE_SCANNER("scanner", "扫码枪"),
    PAY_MODE_WECHATAPPLET("wechatapplet","微信小程序"),
    PAY_MODE_WECHAT("wechat","公众号"),
    PAY_MODE_APP("app","app端"),
    PAY_MODE_APPSCANNER("appscanner","app扫码"),
    ;

    private String code;
    private String desc;

    PayModeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(String value) {
        if (value == null) return "";
        PayModeEnum[] enums = values();
        for (PayModeEnum typeEnum : enums) {
            if (value.equals( typeEnum.getCode())) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static String getValue(String desc) {
        PayModeEnum[] enums = values();
        for (PayModeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
